nanohafandomcom-20200214-history
Magical Girl Lyrical Nanoha Wiki:Semantics
Magical Girl Lyrical Nanoha Wiki uses the extension. This page details how it is used here. Introduction What it is Semantic MediaWiki (SMW for short) is an extension (add-on) for the MediaWiki engine. MediaWiki is likely the most famous and popular wiki engine on the internet, because it is used by Wikipedia, Wikia, and many other prominent sites. One of the reasons MediaWiki is so popular is that it is open-source and allows people to add new functions to itself with so-called "extensions". SMW is one such extension. What it does Normally, a wiki article is nothing but a single body of formatted text. Intuitive wiki markup allows editors to create large but comprehensible articles of a suitable form and structure on practically any topic. There are, however, some wiki contents that have relatively universal appearance. Such are, for example, lists of items in overview articles, which should be maintained for better readability but are boring to compile, prone to errors and often contain obsolete data. To illustrate it with an example: let's say, you have an article about and a few British cities on your wiki. Now you want to list all British cities in the Great Britain article. If you don't have many city articles, it's pretty easy to make that , although copying and formatting each link will be monotonous and boring, at best. But suppose, there are too many cities so you want only the ten most populous. That will be even more laborious, because you need to open every single city article, check its population numbers, sort the resulting (very long, as we said) list by population size, and cut off most of it. Now suppose, a new census comes and you need to update a few values... meaning that you also need to compile that list all over again. Ouch. Here's another example: you have a list of all people from and you have a list of all musicians. Now you write an article on and want a list of all German musicians. Good luck on that. You see the problem: all data that you need is on your wiki but it's incredibly hard to find it because it is hidden under tons of irrelevant (for you but not for others), effectively unstructured information. That, which is the big advantage of wiki engines (free form), turned upon itself and became a drawback. If only the computer would do what it was built for and take over the boring job for you... And that's exactly what SMW does. Basically, it tags some parts of your article texts and gives them meaning ("semantics") and lets you search for specific information later. It's like tags on the blogs and YouTube, except that it's a bit more complex, flexible, and efficient. What you do First of all, you don't have to be proficient with SMW extension to edit this wiki. If you've worked with Wikipedia or any other MediaWiki site, you can work here with little problems. Sometimes, you'll run into unfamiliar constructs in the text but ignore them, it's just SMW. The "tags" in SMW are called . Property types are defined on extra pages in the "Property:" namespace. Property values are set on the content pages. Any page can have as many property values as you like, including several different values of one type. You don't have to explicitly define a property type before adding values of that type to articles. For instance: Ludwig van Beethoven was a profession::musician from born in::Germany. Category:People This is the text of a short article on . The markup in it places the article into the category "People" and adds two property values to it: one of type "Profession" equal "Musician" and one of type "Born in" equal "Germany". Now, back to our Music of Germany article from the second example above. To make a list of all German musicians, all we need to do is add a special SMW function #ask to it: The single line (called "inline query" in SMW terms) above will automatically generate a pretty, hyperlinked bulleted list of all musicians born in Germany, including our Beethoven. Provided, of course, we added correct property values to all their pages. To learn more about adding and browsing property values, read here. How to Adding new properties to an article To add a new property value to an article, place following markup anywhere in the article (note the double colon): [[property name::property value]] To check if your property was set correctly, click "Preview" and scroll down until you see a box named "Facts about..." at the bottom of the page (it is also visible after you save the article, if not, click on the "Refresh" tab at the top of the page). Your new property should be there. If the property name appears as a red link in the "Factbox", it means that such property is not yet defined on the wiki or you have made a typo somewhere. In addition, the code sample above will generate a link to an article titled Property value, just like [[property value]] would normally do, in the article text itself. Alternatively, it will just output property value, if a property with the name Property name exists (you can check it in the Category:Properties) and is not of (you can check the type on the property description page, in its infobox). Basically, in the normal article text, [[property name::...]] works just like regular double square brackets if the property with that name is undefined or it has type "page", or has no visible effect if it is defined and has a type other than "page". Just like with the normal double square brackets, you can use the pipe symbol to enter alternative output text for the tag: [[property name::property value|''alternative text'']] The code sample above will add a property value to the article, just like in the previous example, but the actual value wont appear in the article text. Instead alternative text will appear, with or without a link to an article titled Property value (depending on the type of the property named Property name). If you want to add a property whose value should not appear in the article at all, use following: [[property name::property value| ]] Note the space symbol after the pipe: it is important to leave some whitespace between the pipe and the square brackets, otherwise, the wiki engine won't interpret it correctly. The code above will output nothing, not even a single space to the article text, while adding a property value to it, as usual. If you want to add multiple properties with the same value to an article, use following code: [[property name::another property name::property value]] This will add two equal property values ("Property value") to the article: for a property named Property name and a property named Another property name, respectively. If you add the same property with the same value twice, it will be saved only once by the wiki. It is generally best practice to integrate property value assignments into the normal text flow, as high in the article text as possible. For example, following code maybe a good idea for the first article sentence: Signum is the leader of the is a::Wolkenritter]]. Browsing property values You can see what properties are assigned to an article in the so-called "Factbox". It is located at the bottom of the page, just below the Categories box. If it doesn't appear, click on the "Refresh" tab at the top-right of the page. If it still doesn't appear, it means that the article doesn't have any properties defined yet. You can also see an extended Factbox by clicking on the eye symbol next to its "Facts about ..." headline. In addition to all property values defined in the article itself, it will also list all other articles that link to the current one via properties of . This is useful when you build semantic queries. You can also open the extended Factbox for any article by going to and submitting its name. The classic Wikipedia-like Monobook skin also has a link "Browse properties" in the toolbox on the left but it isn't available in most Wikia default skins. Creating lists and tables Apart from running free-form semantic queries via , adding properties to the queries allows you to add dynamic lists and tables to other articles with the special function . It may appear like a template inclusion code but it isn't: the hash sign (#) indicates that it is a so-called parser function, used to make the wiki engine generate dynamic content. To create a list of articles with certain property values, you must insert corresponding search criteria into the #ask command. For example, to search for all characters who have the property Is a equal to "Number", you should use this code: This will make the wiki engine find all articles that are simultaneously in the Category:Characters and have the property member of::Number, then list them all in a simple, one-line comma-separated list. Like this: . However, you might want to have a bulleted list instead. You can control the output format with the parameter "format", passed to the #ask command just like to a normal template: The term "ul" stands for "unordered list", as opposed to "ol" ("ordered", that is, numbered list). The command above will generate following list: It may sometimes be furthermore necessary to output additional data in the list, e.g. the Inherent Skills and the Inherent Equipment of the respective Numbers. This can be done by adding respective properties to the articles about them, then including them as parameters of the #ask query (preceded with a question mark): As you may have noticed, we are using a different format here, namely, the table, which creates following output: Finally, we may want to sort the query results by the Numbers' serial numbers. Provided we have defined the Property:Index for this purpose and added a correct value to each of their pages, we can use the "sort" parameter in the #ask query to order the results: Following results will be produced: The above barely scrapes the full analytical potential of the SMW. For more information on inline queries and semantic queries in general, see the official documentation. On the last note, the wiki engine may take some time to update all lists and tables after a new page matching their search criteria was added. If your new article doesn't show up on the list, you can force-update it by clicking on the "Refresh" tab on the top-right of the page. Redirects Redirects are treated as synonyms of the page their redirect to by the SMW. In other words, following expression appears in::StrikerS]] will add the same property to the article as appears in::Magical Girl Lyrical Nanoha StrikerS]] except that in the former case, the article text will contain a link to StrikerS redirect, whereas in the latter, directly to the Magical Girl Lyrical Nanoha StrikerS page. On the reverse side, it also means that redirect article names never appear in the results of semantic queries, therefore there is no way, for example, to have just "Nove" appear in an automatically generated list instead of "Nove Nakajima". Semantic Magical Girl Lyrical Nanoha Wiki Guidelines Since basically anyone can add any properties to any article, it is important to maintain overview over them. For this reason, each property type in use should have its own page in the "Property:" namespace, which itself contains (along with a brief explanation of this property's function) following properties: ;Property:Property source:Indicates which categories (or individual articles) normally contain values of this property type. ;Property:Property target:Indicates which categories (or individual articles) normally contain inline queries searching for this property. The reason why we are doing this is to avoid creation of redundant properties (e.g. "Property:Date of birth" and "Property:Birth date", which have the same meaning but different wordings and are treated as unrelated by the engine), as well as unnecessary bidirectional ones. The general rule of a thumb is to have properties that link in the direction from the higher cardinality to the lower cardinality but not vice versa. For example, since it is far less likely for a Device to have multiple masters than for a mage to have several Devices, Property:Master points from the Category:Devices (source) to Category:Characters (target). Before creating new properties, please examine the existing properties list below and consider reusing one of them for your purpose. If none of the existing ones fits, propose its creation on the talk page. Defined properties For a complete list of properties and types used on this wiki (including system ones), see and , respectively. Further reading * on Magical Girl Lyrical Nanoha Wiki * * Introduction to Semantic MediaWiki Category:Semantics